package com.usian.controller;

import com.usian.apis.service.CommentRepayControllerApi;
import com.usian.model.comment.CommentRepayDto;
import com.usian.model.comment.CommentRepayLikeDto;
import com.usian.model.comment.CommentRepaySaveDto;
import com.usian.model.comment.CommentSaveDto;
import com.usian.model.comment.pojos.ApComment;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("comment")
public class CommentController implements CommentRepayControllerApi {
    @Autowired
    private CommentService commentService;

    @RequestMapping("add")
    public ResponseResult add(@RequestBody CommentSaveDto dto){
        return commentService.add(dto);
    }

    @PostMapping("findByUserIdAndEntryId")
    public ResponseResult findByUserIdAndEntryId(@RequestBody CommentSaveDto dto){
        return commentService.findByUserIdAndEntryId(dto);
    }

    @PostMapping("loadCommentRepay")
    @Override
    public ResponseResult loadCommentRepay(CommentRepayDto dto) {
        return commentService.loadCommentRepay(dto);
    }

    @PostMapping("saveCommentRepay")
    @Override
    public ResponseResult saveCommentRepay(CommentRepaySaveDto dto) {
        return commentService.saveCommentRepay(dto);
    }

    @PostMapping("saveCommentRepayLike")
    @Override
    public ResponseResult saveCommentRepayLike(CommentRepayLikeDto dto) {
        return commentService.saveCommentRepayLike(dto);
    }
}
